'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index() {
    const { ctx } = this;
    var {start,limit} = ctx.query
    if(start==undefined){
      start=0
    }
    if(limit==undefined){
      limit = 5
    }
    var data = await ctx.model.Top250.find().skip(Number(start)).limit(Number(limit))
    var total = await ctx.model.Top250.find().count()
    ctx.body = {
        res:data,
        total
    }
  }
}

module.exports = HomeController;
